package com.atguigu;

import java.sql.*;

public class PhoenixJdbc_API {
    public static void main(String[] args) throws SQLException {
        //1.获取连接
        String url = "jdbc:phoenix:hadoop102,hadoop103,hadoop104";
        Connection connection = DriverManager.getConnection(url);

        //2.获取语句预执行者
        PreparedStatement pstm = connection.prepareStatement("select * from student");

        //3.获取结果
        ResultSet resultSet = pstm.executeQuery();

        //4.打印结果
        while (resultSet.next()){
            System.out.println(resultSet.getString(1)+"-"+resultSet.getString(2)+"-"+resultSet.getString(3));
        }


        //关闭资源
        pstm.close();
        //关闭连接
        connection.close();
    }
}
